﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SMSSnew.DATA;
using SMSSnew.CLASSES;


namespace SMSSnew.UI
{
    public partial class StudentDeleteAcc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.EnableViewState = true;


            if (!IsPostBack)
            {
                userAccountDA myuserAccountDA = new userAccountDA();
                DataTable dataUser;
               // dt1 = myuserAccountDA.loadUsername();
                dataUser = myuserAccountDA.loadUser(txtUname.Text);

                if (dataUser.Rows.Count != 0)
                {
                    for (int i = 0; i < dataUser.Rows.Count; i++)
                    {

                        txtUname.Text.Insert(i, dataUser.Rows[i][0].ToString());
                    }
                }


                //dt2 = myDataEntry.loadClassID();

                //if (dt2.Rows.Count != 0)
                //{
                //    for (int i = 0; i < dt2.Rows.Count; i++)
                //    {

                //        cboClassID.Items.Insert(i, dt2.Rows[i][0].ToString());
                //    }
                //}

            }

        }

        protected void Butdelete_Click(object sender, EventArgs e)
        {
            userAccountDA myuserAccountDA = new userAccountDA();
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Are you sure want to delete?')", true);

            //  userAccountDA myuserAccountDA = new userAccountDA();

            myuserAccountDA.checkUser(txtUname.Text);

            if (txtUname.Text == txtUname.Text)
            {
                myuserAccountDA.deleteUser(txtUname.Text);
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('User is successfully deleted')", true);
                txtUname.Text = "";
            }

            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('User is already ot exist...!')", true);
                txtUname.Text = "";
            }
        }

      
        
    }
}
